<template>
  <div class="h5-wrapper">
    <div class="content">
      <!-- 首页版块-二级路由出口 -->
      <router-view></router-view>
    </div>
    <nav class="tabbar">
      <router-link to="/layout/article">面经</router-link>
      <router-link to="/layout/collect">收藏</router-link>
      <router-link to="/layout/like">喜欢</router-link>
      <router-link to="/layout/user">我的</router-link>
    </nav>
  </div>
</template>

<script>
export default {
  name: "LayoutPage",
  created() {
    console.log("created--组件创建完成");
  },
  mounted() {
    console.log("mounted-组件挂载完成");
  },
  destroyed() {
    console.log("destroyed-组件被销毁了");
  },
  // --------组件被缓存后会执行的两个钩子函数--------------
  activated() {
    alert("进入首页");
    console.log("activated-缓存组件被激活时调用");
  },
  deactivated() {
    alert("离开首页");
    console.log("deactivated-缓存组件失活时调用");
  },
};
</script>

<style>
body {
  margin: 0;
  padding: 0;
}
</style>
<style lang="less" scoped>
.h5-wrapper {
  .content {
    margin-bottom: 51px;
  }
  .tabbar {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    display: flex;
    background: #fff;
    border-top: 1px solid #e4e4e4;
    a {
      flex: 1;
      text-decoration: none;
      font-size: 14px;
      color: #333;
      -webkit-tap-highlight-color: transparent;
    }
  }
}
</style>